<?php 
$found=(isset($found)?$found:false);
$combo_mon = "";
?>

<table width="100%" cellpadding="0" cellspacing="0">
            <tr>
            <td valign="top"> 
            
            <table id="tbl_otserv" class="tableIn" width="100%" border="1" rules="all" cellpadding="0" cellspacing="0" >     
         <caption align="left">  
         <strong>Servicios</strong>
         </caption>
          <thead>
          
          <tr>
            <th></th>
            <th>ID</th>
            <th>Textos</th>
            <th>Descripción</th>     
            <th>Precio</th>
            <th>Mon</th>
            <?php if($opc<=1){ ?>
            <th>Accion</th>
            <?php } ?>
          </tr>
          </thead> 
          <tbody >
            <tr class="trLast"  >
              <td><?php echo '';?></td>
                <td>
                <nobr>
                <input type="text"  class="txt-idserv" onchange="inputSrvOT(this)" ondblclick="searchSrvOT(this);"   maxlength="6" /></nobr>                </td>
                <td><input type="button" name="button" id="button" value="[....]" onclick="saveTxtOt(this,0)" /></td>
              <!--                 <td class="txt-txsrv"></td>-->
<td><input type="text" class="txt-txsrv" maxlength="40" /></td>
                <td>
                  <input type="text" name="t_ot_psrv" class="qt txt-psrv" id="t_ot_psrv" />                </td>
                <td><select class="mon-item"><?php include '../../Query_min/getMonedas.php'; 
					$combo_mon = str_replace("selected","",$combo_mon); ?></select></td>
                <?php  ?>
                <td class="del-item">
                <input type="button" class="del-item" title="Quitar Item" value="X" onClick="deleteItem(this)" />                </td>               
            </tr>
            
            <?php 
			  if($found){
			   $sqldet="call usp_listDetailOrdenTrabajo('".$idOrdTra."')";
			   $resdet = $mysqli->exeQuery($sqldet);
	          if($resdet){	
			  while($row = $resdet->fetch_assoc()){
			   	  
			?>
              <tr  >
                <td class="txt-itm"><?php echo $row['ItemServ'];?></td>
              <td>
              <span class="txt-idserv" title="<?php echo $row['ServID'];?>"><?php echo $row['ServID'];?></span><!--
              <input type="text"  class="txt-idserv" onKeyPress="enterText(event,this)" title="<?php echo $row['ServID'];?>"    maxlength="6"  value="<?php echo $row["ServID"]?>"  />-->              </td>
              <td><input type="button" name="button" id="button" value="[....]" onclick="saveTxtOt(this,0)" /></td>
              <!--                <td class="txt-txsrv"><?php echo $row["nomServ"]?></td> -->
<td><input class="txt-txsrv" title="<?php echo $row['TextItem'];?>" maxlength="40" value="<?php echo $row["nomServ"]?>" /></td>
                <td class="qt"><input type="text" value="<?php echo $row["impSerMan"]?>" class="qt txt-psrv" /></td>
                 
                <td><select class="mon-item"><?php echo str_replace("value='".$row['MoneyID']."'", "value='".$row['MoneyID']."' selected",$combo_mon) ;?></select></td>
                <td class="del-item">
                <input type="button" class="del-item" title="Quitar Item" value="X" onClick="deleteItem($(this))" />                </td>
            </tr>
            <?php 
			     }
				 $resdet->close();
                 $mysqli->check_result();
			    }
			  }
			?>
          </tbody>
          <?php ?>
          <tfoot>
          <tr>
                <td colspan="7" style="text-align:left;">
                 <input type="button"  name="btn-add-item"  onclick="addItemServ()" id="btn-add-item" value="Agregar" />                </td>
          </tr>
          </tfoot>
          <?php ?>
		</table> 
</td>
<td>&nbsp;</td>
            <td valign="top">             
         <span id="DivListArt">
         <table id="tbl_otarticulos" class="tableIn" width="100%" border="1" rules="all" cellpadding="0" cellspacing="0" > 
        <caption align="left"><strong>Articulos</strong>
         </caption>
          <thead>
          <tr >
               <th>Servicio</th>
               <th>Id Articulo</th>
               <th class="noView">Item </th>
               <th>Articulo</th>
 			   <th class="noView">Costo</th>
               <th class="noView">Precio</th>
               <th>Cantidad</th>
            </tr>
          </thead>
          <tbody>
            <?php 
			    if($found){
				  
				  $sqlart="call usp_listArticulosOrdnTrabajo('".$idOrdTra."')";	
				  $resart = $mysqli->exeQuery($sqlart);
				  if($resart){	
				    while($row = $resart->fetch_assoc()){
			?>		 
				     <tr class="<?php echo $row['ItemServ']?>">	 
                        <td><?php echo $row['desDetSer'] ?></td>
                        <td><?php echo $row['ArticuloID'] ?></td>
                        <td><?php echo $row['ItemArt'] ?></td>
                        <td><?php echo $row['ArticuloName'] ?></td>
                        <td class="qt noView"><?php echo $row['ArticuloCos'] ?></td>
                        <td class="qt noView"><?php echo $row['ArticuloPre'] ?></td>
                        <td class="qt noView"><?php echo $row['cantArt'] ?></td>
                     </tr>
			<?php		   
				    }
					$resart->close();
                    $mysqli->check_result();
				  }
					
			    } 
			?>
          </tbody>
        </table>
        </span>
            </td>
            </tr>
            </table>